<template>
    <van-grid clickable :column-num="4">
        <van-grid-item to="/register/commom" v-for="(item , index) in hot" :key=" '热门科室' + index" @click="toCommon(item.id)">
            <van-icon :name="item.name" color="#1486fa" />
            <p style="font-size: 12px;">{{ item.int }}</p>
        </van-grid-item>
    </van-grid>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import $bus from "../../config/eventBus"; 

// 热门科室数据
const hot = ref([
    { name: 'like-o', route: '/register/commom', int: '心脏科', id: 11},
    { name: 'eye-o', route: '/register/commom', int: '眼科' , id: 13 },
    { name: 'user-o', route: '/register/commom', int: '男科', id: 12 },
    { name: 'contact', route: '/register/commom', int: '妇科', id: 1 },
])

// 
const toCommon = (id: number) => {
   console.log(id);
   $bus.emit('selectDepartment',id)

}

</script>

<style scoped lang="scss">

</style>